package com.hs.srm.task;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.hs.srm.admin.modules.orders.service.StockService;
import com.hs.srm.admin.modules.requisition.service.NproPurchRequestItemService;
import com.hs.srm.admin.modules.ssess.service.SsessService;
import sunnykid.task.SunnykidTimer;
import sunnykid.task.TaskManager;

/**
 * 
 * <p>標題：测试定时任务</p>
 * <p>描述：测试定时任务</p>
 * <p>版權：版權所有 (c) 2019</p>
 * <p>組織：厚声集团</p>
 *
 * @author 鐘曉籟
 * @version V1.0.0
 * @date 2019年4月19日 下午5:08:12
 * @since V1.0.0
 */
@Component
public class MyTimer {
	
	@Autowired
	private NproPurchRequestItemService mproPurchRequestItemService;
	@Autowired
	private  SsessService ssessService;
	@Autowired
	private  StockService stockService;
	
	@PostConstruct
	public void initTask() {
		SunnykidTimer timer = TaskManager.createTimer(new MyTask(mproPurchRequestItemService,ssessService,stockService));
		//timer.start(3000);// 每隔3秒运行一次
		timer.start(5000, 100000);// 第一个参数是延迟时间毫秒数，第二个参数是运行间隔毫秒数
	}

}
